<?php

use DbManager;

session_start();
include('cfg/cfg.inc.php');
$db = new DbManager();
$db->connect(DBHOST, DBUSER, DBPWD, true, true, DBNAME, "");
$list = $db->query_select("cllg_entity", NULL);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Datos de Usuario</title>
        <link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
        <link href="css/ContentStyle.css" rel="stylesheet" type="text/css" />

        <style type="text/css">
            <!--

            body {
                background-image: url(img/background.png);
            }
            -->
        </style>
        <script src="js/prototype.js" type="text/javascript"></script>
        <script src="js/dialog/dialog.2.0.js" type="text/javascript"></script>
        <script src="js/include.js" type="text/javascript"></script>
        <script type="text/javascript">
            doLogin = function(ob) {
                waitMsg("Validando...");
                $('usuario').request({onComplete: function(r) {
                        closeWait();

                        res = r.responseJSON;
                        if (res.STATUS == 1) {
                            $('usuario').action = res.ACTION;
                            waitMsg("Cargando...");
                            $('usuario').submit();
                        } else {
                            Dialogs.alert(res.ERROR + "-" + res.PASS);
                        }
                    }});
            }
        </script>
        <style type="text/css" >
            .container {
                width: 450px;
            }

            /* The white background content wrapper */
            .container > .content {
                background-color: #fff;
                padding: 20px;
                -webkit-border-radius: 10px 10px 10px 10px;
                -moz-border-radius: 10px 10px 10px 10px;
                border-radius: 10px 10px 10px 10px;
                -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
                -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
                box-shadow: 0 1px 2px rgba(0,0,0,.15);
            }

            .login-form {
                margin-left: 65px;
            }
            #login-cont {
                position: absolute;
                width: 574px;
                height: 252px;
                z-index: 1;
                left: 385px;
                top: 277px;
            }

        </style>
        <link href="js/dialog/dialog.2.0.css" rel="stylesheet" type="text/css" />
    </head>


    <body>
        <div id="wrapper">
            <div id="logocinde"></div>
            <div id="logoempresa"></div>
            <div id="login-cont">
                <div class="container">
                    <div class="content">
                        <div class="login-form">
                            <h2>Ingreso de Usuarios</h2>
                            <form id="usuario" name="usuario" method="post" action="include/login.php">
                                <fieldset>
                                    <div class="clearfix">
                                        <input name="usuario" type="text" id="usuario" size="30" maxlength="30" placeholder="Usuario"/>
                                    </div>
                                    <div class="clearfix">
                                        <input name="clave" type="password" id="clave" size="30" maxlength="50" placeholder="Contraseña"/>
                                    </div>
                                    <div class="clearfix">
                                        <select name="entidad" id="entidad">
                                            <option value="">--Seleccione entidad--</option>
                                            <?php foreach ($list as $it) { ?>
                                                <option value="<?php echo $it["ID"]; ?>" > <?php echo $it["NAME"]; ?> </option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <input name="entrar" onclick="javascript:doLogin(this);" type="button" class="btn btn-info" id="entrar" value="Ingresar" />
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
